1. we were off by one when deciding if we could just concatentate
the generated suffix to the name, failing to use the last available
character.
2. when attempting to copy the generated suffix to a presumably
shortened name, and the generated suffix was longer than the name,
the target of the copy was outside the name buffer. In the common
case that the rank of size_t was greater than the rank of int, the
target was well beyond the end of name, not before as one would expect
with signed arithmetic.
With the new algorithm when the target length is insufficient to
fit both the name and the suffix we will only truncate the name as
required to fit the truncated name and the complete suffix in the
target length(as opposed to the original length of the name).
We fatal if this is not possible.
Add a test case to exercise the make unique code.
* fix reference mode.
* add notes for future enhancements
* fix testcase cut and paste booboo
* refactor mkshort input from char* to QByteArray.
Tyler MacDonald [Mon, 28 Aug 2023 22:31:04 +0000 (18:31 -0400)]
Add support for Google Takeout Location History (#1160)
* Add support for Google Takeout Location History
This adds support for parsing the location history provided by Google Takeout.
This makes it possible to convert a month's, year's, or your entire location
history at once instead of having to export one day's history at a time on
Google Maps.
There is documentation in the `xmldoc` folder with some examples.
It works great, but there are one, possibly two, other additions I'd like to
make in following diffs:
1. Add the ability to select date ranges. For example, I went on a road trip
that started in the last week of February, but right now I can only select
tracks at the resolution of a whole month.
2. Add support for the higher-resolution "roadSegment" blocks in newer
"activitySegment" blocks. This will have to be optional as you have to
query the Google Maps API to get lat/long, which costs money. However,
if you're willing to pay for it, you can get great detail out of it.
They look like this:
* don't leak objects when we skip events at exact lat/lon 0/0
* use a reference (even though the compiler would have optimized that away)
* rename to googletakeout
* fix docs
* Address code review requests
* add `googletakeout.h` to HEADERS
* convert most `#define`s to static members
* don't pollute global namespace
* rename logging functions
* convert some methods to static functions for clang-tidy
* `title_case` loop by reference instead of by index (clang-tidy)
* better use of debugging levels
* drop dead simplifiedRawPath code for now
* drop empty tracks
* default constructor for GoogleTakeoutInputStream
* add some tests that check the content of the data
Also, I found some unofficial documentation about the location history
format and added that (thanks @CarlosBergillos !)
* apply @tsteven4 's patch. thank you!!
* add license
* fix logging
* As I assigned the correct license to my code, I am skeptical that this makes a difference, but give Robert co-copyright.
* make the test more boring
* rm xml_slice
* revert constructor change from @tsteven4 's patch
tsteven4 [Wed, 23 Aug 2023 16:32:23 +0000 (10:32 -0600)]
resolve maintanence issue in interpolate & resample filters. (#1161)
* resolve maintanence issue in interpolate filter.
Instead of manually creating a deep copy of the route list with
an empty waypoint list we operate on the original route list by
swapping it's waypoint list with an empty list. This is both more
efficient and easier to maintain.
* resolve maintanence issues in resample filter.
Instead of manually creating a deep copy of the route list with
an empty waypoint list we operate on the original route list by
swapping it's waypoint list with an empty list. This is both more
efficient and easier to maintain.
tsteven4 [Sat, 5 Aug 2023 15:57:33 +0000 (09:57 -0600)]
Introduce efficient member functions for deleting waypoints (#1151)
* Introduce efficient member functions for deleting waypoints
New functions with complexity O(n) for deleting pre-marked
waypoints are:
WaypointList::del_wpts
RouteList::del_wpts
del_wpts
route_del_wpts
track_del_wpts
Use those functions instead of the inefficient versions
WaypointList::waypt_del
RouteList::del_wpt
waypt_del
route_del_wpt
track_del_wpt.
When these functions are using while looping over a waypoint list
the overall complexity is O(n^2). This is because these functions
themselves amortize to O(n).
1. With the length option the last point deleted took the total error
over the specified limit.
2. When computing the total error if another point is deleted it was
possible to refer to an xte record that needed to be updated due to
the deletion of one of its neighbors.
* wip on reduced complexity simplify filter.
* mimic ineheitence of new_trkseg flag in simplify filter.
1. With the length option the last point deleted took the total error
over the specified limit.
2. When computing the total error if another point is deleted it was
possible to refer to an xte record that needed to be updated due to
the deletion of one of its neighbors.
reduce complexity of gdb waypt searchs from O(n^2) to O(n) (#1141)
* use QHash for gdb waypoint searches.
This reduces the complexity from O(n^2) to O(n).
For the reader two parallel hashes are maintained with different
keys but identical values. This is necessary because sometimes
we want to match the name and position, and other times we just want
to match the name.
* workaround missing qHashMulti in Qt5.
and supply missing default for our qHash functions.
* fix MSVC C2666 errors due to an erroneous assumption.
In Qt6 the return type of qHash, and the type of the seed,
happens to be the same as QHash::size_type.
However, this isn't true in Qt5.
Robert Lipe [Wed, 19 Jul 2023 11:01:24 +0000 (06:01 -0500)]
Deprecate navilink, sbn, sbp. (#1138)
As discussed in
https://github.com/GPSBabel/gpsbabel/pull/1090
these units have long since been deprecated by their maker. We have no
known remaining users. Numerous attempts (including phone calls and
attempt to contact via the windsurfing community) to reach the last
known users have all failed.
tsteven4 [Tue, 16 May 2023 21:44:47 +0000 (15:44 -0600)]
refactor unicsv & xcsv date time handling (#1114)
* refactor unicsv date time handling.
* restrict utc option range to match Qt offsetfromutc
* move xcsv from C-style legacy time to Qt.
* fill in lower order date/time fields when parsing.
* don't return date/time if we don't have one!
* enhance xcsv date/time testing, fix bug.
* csv format date time adjustements.
use QDateTime::fromString to parse iso date times.
return invalid QTime from addhms if parsing fails entirely.
* datetime display fixes.
For the xcsv writer:
avoid priting date/time fields when there isn't a valid date/time.
when printing with am/pm use times from a 12 hour clock.
add support for printing dotnet time.
use QDateTime::toString to print ISO time.
For the xcsv and unicsv readers:
use QDateTime::fromString instead of xml_parse_time when reading
ISO datetimes. This avoids xml_parse_times intentional odd behavior
of treating non-timezoned times as UTC.
add a test of the xcsv writer time related fields. This only runs
in America/Denver time zone. As setting the time zone is system
dependent the test only runs if tzselect is available. If so it
assumes America/Denver is available.
correct documentation to give a sensible format for xcsv field GMT_TIME.
* add reference files for new test.
* silence xcsv reader conversion warnings on empty strings.
* warn on parse errors reading excel time.
* xcsv date/time fixes.
fix addhms to account for 12/24 hour clock.
don't print invalid datetimes with iso_time, iso_time_ms.
add testcases to exercise all the xcsv reader date/time flavors.
* clarify HMSL, HMSG wrt 12/24 hour clocks.
* add missing reference file.
* enhance xcsv for HMS[L|G] before or after [LOCAL|GMT]_TIME
* restore YYYYYMMDD to use UTC.
This has been broken for some time. Mail from 2012 indicates the intent
was UTC (https://sourceforge.net/p/gpsbabel/mailman/message/29544538/)
* unicsv review catches
don't ripple into trouble with msec rounding.
pass outputs that may or may not be written as references.
* retire xcsv fields HMSG_TIME, HMSL_TIME.
This is potentially a user visible change. It could require
users to rewrite any style files they have created that use
these fields.
These are replaced by repeated use of GMT_TIME and LOCAL_TIME.
This eliminates our pain over 12/24 hour clock issues. strptime/
strftime (as well as QTime) have distinct conversion specifiers
for hours with 12/24 hour clocks. Our support for HMSG_TIME,
HMSL_TIME used integer conversion specifiers for hours, minutes
and seconds. This made it difficult to decide if a 12 or 24 hour
clock should be used, and made it impossible to have reduced
precision values with 12 hour clock using an AM/PM designation.
We also always printed AM/PM designations.
tsteven4 [Mon, 15 May 2023 19:03:47 +0000 (13:03 -0600)]
restore tab when display vector formats. (#1116)
this was lost in #1068
update reference files to be exactly what the test produces, including
exact whitespace, trailing tabs and no newline at end of file.
tsteven4 [Sun, 14 May 2023 20:25:04 +0000 (14:25 -0600)]
add testing for kml:dateTimeType. (#1112)
and fix a related bug.
Note that we incorrectly, for kml:dateTimeType, force values
without time zone qualifiers to UTC.
We do not test the optional gYearMonth time zone qualifer.
We do not test the optional gYear time zone qualifer.
We do not test the optional date time zone qualifer.
tsteven4 [Fri, 12 May 2023 15:48:24 +0000 (09:48 -0600)]
restrict osm timestamps. (#1107)
osm consumers may not accept fractional seconds, but all should
support whole seconds.
osm consumers may not accept time zone designations other than Z,
but all should support time zone designation Z.
See https://github.com/osmcode/osmium-tool/issues/267